Bipartite Networks

Bipartite Networks: Community ecology’s gateway to ecological networks

Bipartite Networks from Community Matrices

Community Matrix = Occurrences (Sites x Species)

sp1 sp2 sp3
site1 1 1 1
site2 1 1 0
site3 1 1 0
site4 1 0 0
site5 1 0 0

Bipartite Networks from Community Matrices

Bipartite Network = Interactions (Species x Species)

sp6 sp7 sp8
sp1 1 1 1
sp2 1 1 0
sp3 1 1 0
sp4 1 0 0
sp5 1 0 0

Bipartite Networks

Bipartite Networks

Examples:

  • Plant Pollinator
  • Plant Herbivore
  • Plant Parasite

Mutualistic Networks (Bascompte and Jordano 2014)

Mutualistic Networks (Bascompte and Jordano 2014)

Individuals

  • In reality, interactions occur among individuals

Individuals <-> Genotype <-> Species

Genotype or other genetic clustering information can help to bridge the gap between looking at interactions among all individuals and integrating to the species level.

Genotype-Species (Lau et al. 2016)

Genotype-Species (Lau et al. 2016)

In general, Bipartite Networks

  • Advantage: Provides a theoretical framework that provides mechanistic hypotheses for stability
  • Limitation: a sub-set of the entire community and interactions

Bipartite Network Analysis

The following notes focus on using the bipartite package for analysis and draws directly from this paper:

Dormann, C.F., Fruend, J., Bluethgen, N. & Gruber B. 2009. Indices, graphs and null models: analyzing bipartite ecological networks. The Open Ecology Journal, 2, 7-24.

Bipartite Network Metrics

  • There are many ways to look at a bipartite network
  • These metrics can be categorized into metrics derived directly from the network graph information (base quantities) and metrics that combine the lower level metrics together (higher order indices)

Base Quantities

  • L: number of realized links in a network
  • I: number of lower trophic level species (e.g. plants, prey)
  • J: number of higher trophic level species (e.g. pollinators, parasitoids)
  • m: total number of interactions for all species
  • \(a_{ij}\): number of interactions between species i from the lower and species j from the higher trophic level, also referred as “link weight”
  • \(A_i\) (\(\sum_{j=1}^J a_{ij}\)): total number of interactions of species i from the lower trophic level
  • \(A_j\) (\(\sum_{i=1}^I a_{ij}\)): total number of interactions of species j from the higher trophic level

Higher Indices (Unweighted)

  • Links per Species
  • Connectance
  • Cluster Coefficient
  • Web Asymmetry
  • Number of Compartments
  • Extinction Slopes
  • Degree Distribution
  • Mean Number of Shared Hosts
  • Togetherness
  • C-Score
  • V-Ratio
  • Nestedness

Higher Indices (Weighted)

  • Nestedness (WINE)
  • Modularity
  • Generality
  • Vulnerability
  • Weighted Linkage Density
  • Interaction Evenness
  • Interaction Strength Asymmetry
  • Niche Overlap

The main focus of bipartite ecological networks has been:

  • Nestedness
  • Modularity

Nestedness

Nestedness: Packing Communities

Nestedness: Packing Communities

Nestedness is the tendancy for interactions in communities to be organized such that species with fewer interactions interact with subsets of species with more interactions.

This is suggested to facilitate community stability by decreasing competition for resources and optimizing the redundancy of interactions.

Nestedness: Packing Communities

Nestedness: Packing Communities

Measuring Nestedness: Many Metrics

Measuring Nestedness: Many Metrics

1. Ordering

1. Ordering

2. Isocline

2. Isocline

3. Deviations

3. Deviations

Exercise: Play with matrix ordering

Exercise: Play with matrix ordering

M <- c(rep(1,10),
        c(rep(1,4),rep(0,6)),
        c(rep(1,3),rep(0,7)),
        c(rep(1,2),rep(0,8)),
        rep(c(rep(1,1),rep(0,9)),6)
         )
M <- matrix(M,nrow=10)
rownames(M) <- paste('P',1:10,sep='')
colnames(M) <- paste('A',1:10,sep='')

Exercise: Play with matrix ordering

M
##     A1 A2 A3 A4 A5 A6 A7 A8 A9 A10
## P1   1  1  1  1  1  1  1  1  1   1
## P2   1  1  1  1  0  0  0  0  0   0
## P3   1  1  1  0  0  0  0  0  0   0
## P4   1  1  0  0  0  0  0  0  0   0
## P5   1  0  0  0  0  0  0  0  0   0
## P6   1  0  0  0  0  0  0  0  0   0
## P7   1  0  0  0  0  0  0  0  0   0
## P8   1  0  0  0  0  0  0  0  0   0
## P9   1  0  0  0  0  0  0  0  0   0
## P10  1  0  0  0  0  0  0  0  0   0

Exercise: Play with matrix ordering

M[sample(1:10,10),sample(1:10,10)]
##     A7 A9 A4 A3 A2 A10 A1 A5 A6 A8
## P8   0  0  0  0  0   0  1  0  0  0
## P2   0  0  1  1  1   0  1  0  0  0
## P7   0  0  0  0  0   0  1  0  0  0
## P5   0  0  0  0  0   0  1  0  0  0
## P4   0  0  0  0  1   0  1  0  0  0
## P1   1  1  1  1  1   1  1  1  1  1
## P6   0  0  0  0  0   0  1  0  0  0
## P10  0  0  0  0  0   0  1  0  0  0
## P3   0  0  0  1  1   0  1  0  0  0
## P9   0  0  0  0  0   0  1  0  0  0

Exercise: Play with matrix ordering

M[sample(1:10,10),sample(1:10,10)]
##     A3 A9 A10 A6 A5 A8 A4 A2 A1 A7
## P2   1  0   0  0  0  0  1  1  1  0
## P1   1  1   1  1  1  1  1  1  1  1
## P3   1  0   0  0  0  0  0  1  1  0
## P9   0  0   0  0  0  0  0  0  1  0
## P4   0  0   0  0  0  0  0  1  1  0
## P6   0  0   0  0  0  0  0  0  1  0
## P5   0  0   0  0  0  0  0  0  1  0
## P7   0  0   0  0  0  0  0  0  1  0
## P8   0  0   0  0  0  0  0  0  1  0
## P10  0  0   0  0  0  0  0  0  1  0

Exercise: Play with matrix ordering

M[sample(1:10,10),sample(1:10,10)]
##     A10 A1 A2 A9 A8 A3 A5 A4 A6 A7
## P8    0  1  0  0  0  0  0  0  0  0
## P9    0  1  0  0  0  0  0  0  0  0
## P5    0  1  0  0  0  0  0  0  0  0
## P3    0  1  1  0  0  1  0  0  0  0
## P4    0  1  1  0  0  0  0  0  0  0
## P7    0  1  0  0  0  0  0  0  0  0
## P1    1  1  1  1  1  1  1  1  1  1
## P10   0  1  0  0  0  0  0  0  0  0
## P2    0  1  1  0  0  1  0  1  0  0
## P6    0  1  0  0  0  0  0  0  0  0

Testing for Nestedness

  • Calculate the nestedness for a given network
  • Choose an algorithm to shuffle
  • Shuffle the interactions
  • Calculate nestedness for the shuffled network
  • Repeat a lot, like thousands of times
  • Compare the observed to the “null” nestedness values

This is a general recipe for bipartite network analysis

  • Calculate the metric for a given network
  • Choose an algorithm to shuffle
  • Shuffle the interactions
  • Calculate metric for the shuffled network
  • Repeat a lot, like thousands of times
  • Compare the observed to the “null” metric values

Testing for Nestedness

obs <- 45
null <- rnorm(1000,65,9)
hist(null,main='')
abline(v=obs)

Testing for Nestedness

z.score <- (obs - mean(null)) / sd(null)
p.value <- length(null[null <= obs])/length(null)

z.score
## [1] -2.180544
p.value
## [1] 0.011

Exercise: Nestedness Analysis

library(bipartite)
data(Safariland)
Safariland

Exercise: Nestedness Analysis

##                          Policana albopilosa Bombus dahlbomii
## Aristotelia chilensis                    673                0
## Alstroemeria aurea                         0              154
## Schinus patagonicus                        0                0
## Berberis darwinii                          0               67
## Rosa eglanteria                            0                0
## Cynanchum diemii                           0                0
## Ribes magellanicum                         0                0
## Mutisia decurrens                          0                0
## Calceolaria crenatiflora                   0                0
##                          Ruizantheda mutabilis Trichophthalma amoena
## Aristotelia chilensis                      110                     0
## Alstroemeria aurea                           0                     0
## Schinus patagonicus                          0                     0
## Berberis darwinii                            0                     0
## Rosa eglanteria                              6                     0
## Cynanchum diemii                             0                     0
## Ribes magellanicum                           0                     2
## Mutisia decurrens                            0                     0
## Calceolaria crenatiflora                     0                     0
##                          Syrphus octomaculatus Manuelia gayi
## Aristotelia chilensis                        0             0
## Alstroemeria aurea                           5             7
## Schinus patagonicus                          0             0
## Berberis darwinii                            5             0
## Rosa eglanteria                              4             0
## Cynanchum diemii                             0             0
## Ribes magellanicum                           0             0
## Mutisia decurrens                            0             0
## Calceolaria crenatiflora                     0             0
##                          Allograpta.Toxomerus Trichophthalma jaffueli
## Aristotelia chilensis                       0                       0
## Alstroemeria aurea                          1                       3
## Schinus patagonicus                         0                       0
## Berberis darwinii                           0                       0
## Rosa eglanteria                             2                       0
## Cynanchum diemii                            0                       0
## Ribes magellanicum                          3                       0
## Mutisia decurrens                           0                       0
## Calceolaria crenatiflora                    1                       0
##                          Phthiria Platycheirus1 Sapromyza.Minettia
## Aristotelia chilensis           0             4                  0
## Alstroemeria aurea              8             1                  1
## Schinus patagonicus             0             0                  0
## Berberis darwinii               0             0                  0
## Rosa eglanteria                 0             0                  0
## Cynanchum diemii                0             0                  0
## Ribes magellanicum              0             0                  0
## Mutisia decurrens               1             0                  0
## Calceolaria crenatiflora        0             0                  0
##                          Formicidae3 Nitidulidae Staphilinidae
## Aristotelia chilensis              0           0             0
## Alstroemeria aurea                 0           0             4
## Schinus patagonicus                0           0             0
## Berberis darwinii                  0           0             0
## Rosa eglanteria                    0           0             3
## Cynanchum diemii                   8           1             0
## Ribes magellanicum                 0           0             0
## Mutisia decurrens                  0           0             0
## Calceolaria crenatiflora           0           0             0
##                          Ichneumonidae4 Braconidae3 Chalepogenus caeruleus
## Aristotelia chilensis                 1           0                      0
## Alstroemeria aurea                    0           0                      0
## Schinus patagonicus                  15           0                      0
## Berberis darwinii                     0           0                      0
## Rosa eglanteria                       0           0                      0
## Cynanchum diemii                      0           2                      0
## Ribes magellanicum                    0           0                      0
## Mutisia decurrens                     0           0                      0
## Calceolaria crenatiflora              0           0                      3
##                          Vespula germanica Torymidae2 Phthiria1
## Aristotelia chilensis                    0          0         0
## Alstroemeria aurea                       4          0         1
## Schinus patagonicus                      0          0         0
## Berberis darwinii                        0          0         0
## Rosa eglanteria                          0          0         0
## Cynanchum diemii                         0          9         0
## Ribes magellanicum                       0          0         0
## Mutisia decurrens                        0          0         0
## Calceolaria crenatiflora                 0          0         0
##                          Svastrides melanura Sphecidae Thomisidae
## Aristotelia chilensis                      0         0          0
## Alstroemeria aurea                         6         1          1
## Schinus patagonicus                        0         0          0
## Berberis darwinii                          0         0          0
## Rosa eglanteria                            0         0          0
## Cynanchum diemii                           0         0          0
## Ribes magellanicum                         0         0          0
## Mutisia decurrens                          0         0          0
## Calceolaria crenatiflora                   0         0          0
##                          Corynura prothysteres Ichneumonidae2
## Aristotelia chilensis                        1              0
## Alstroemeria aurea                           3              4
## Schinus patagonicus                          0              0
## Berberis darwinii                            0              0
## Rosa eglanteria                              0              0
## Cynanchum diemii                             0              0
## Ribes magellanicum                           0              0
## Mutisia decurrens                            0              0
## Calceolaria crenatiflora                     0              0
##                          Ruizantheda proxima Braconidae2
## Aristotelia chilensis                      0           1
## Alstroemeria aurea                         4           0
## Schinus patagonicus                        0           0
## Berberis darwinii                          0           0
## Rosa eglanteria                            0           0
## Cynanchum diemii                           0           0
## Ribes magellanicum                         0           0
## Mutisia decurrens                          0           0
## Calceolaria crenatiflora                   0           0

Exercise: Nestedness Analysis

plotweb(Safariland)

Exercise: Nestedness Analysis

plotweb(Safariland,text.rot=90)

Exercise: Nestedness Analysis

nested(Safariland)
## binmatnest2.temperature 
##                19.81353

Exercise: Nestedness Analysis

nested(Safariland,method='ALL')
##  binmatnest2.temperature               binmatnest discrepancy2.discrepancy 
##               19.7534631                5.7626076               15.0000000 
##              discrepancy                  C.score                  checker 
##               21.0000000                0.5616097                1.0227920 
##                    NODF2                     NODF            weighted NODF 
##               24.5478036               18.0878553               11.6063738 
##                     wine 
##                0.3685509

Exercise: Nestedness Analysis

safari.nest <- nestedness(Safariland)
names(safari.nest)
##  [1] "mat"             "n.rows"          "n.cols"         
##  [4] "temperature"     "n.nullmodels"    "population.size"
##  [7] "n.individuals"   "binmatnestout"   "n.generations"  
## [10] "nullmodels"      "p.null1"         "mean.temp.null1"
## [13] "var.temp.null1"  "p.null2"         "mean.temp.null2"
## [16] "var.temp.null2"  "p.null3"         "mean.temp.null3"
## [19] "var.temp.null3"  "pack.order.col"  "pack.order.row" 
## [22] "packed.matrix"

Exercise: Nestedness Analysis

unlist(safari.nest[c('temperature')])
## temperature 
##    5.762608
unlist(safari.nest[c('p.null1','p.null2','p.null3')])
## p.null1 p.null2 p.null3 
##       0       0       0
unlist(safari.nest[c('mean.temp.null1','mean.temp.null2','mean.temp.null3')])
## mean.temp.null1 mean.temp.null2 mean.temp.null3 
##        28.14982        27.33150        18.72031
unlist(safari.nest[c('var.temp.null1','var.temp.null2','var.temp.null3')])
## var.temp.null1 var.temp.null2 var.temp.null3 
##       27.66088       33.82524       36.37121

Modularity

Modularity: Eggs in Multiple Baskets

Modularity: Eggs in Multiple Baskets

Nestedness and Modularity: measure interaction structure

Nestedness Revisited

Nestedness Revisited

Nestedness and Modularity: measure interaction structure

Nestedness Revisited

Nestedness Revisited

Modularity: Eggs in Multiple Baskets

Modularity: Eggs in Multiple Baskets

Modularity: Eggs in Multiple Baskets

Modularity: Eggs in Multiple Baskets

  • Modularity: the tendancy of species to interact more within than between groups that are subsets of the entire community
  • This is thought to stabilize communities by restricting the impact of disturbances within groups and preventing cascading effects throughout the larger community

Modularity: Eggs in Multiple Baskets

Modularity: Eggs in Multiple Baskets

Modularity

safari.mods <- computeModules(Safariland)

Modularity

plotModuleWeb(safari.mods)

Testing Modularity

null.nets <- lapply(1:5,commsimulator,x=Safariland,method='r1')
null.mods <- lapply(null.nets,computeModules)
null.stats <- lapply(null.mods,function(x) slot(x,'likelihood'))
null.stats <- unlist(null.stats)

Testing Modularity

obs.mods <- slot(safari.mods,'likelihood')
null.mu <- mean(null.stats)
null.sd <- sd(null.stats)
null.z <- (obs.mods - null.mu) / null.sd
null.p <- length(null.stats[null.stats <= obs.mods])/length(null.stats)
null.z
## [1] -1.291243
null.p
## [1] 0

Nested and Modules

Nested and Modules